package com.link.base.base.crowd.service;

import com.link.base.base.crowd.dao.mybatis.mapper.CrowdAggritemMapper;
import com.link.base.base.crowd.model.CrowdAggritem;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.model.BasicModel;
import com.link.core.basic.query.Filter;
import com.link.core.basic.query.QueryParams;
import com.link.core.basic.query.Sorter;
import com.link.core.basic.service.BasicServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 人群二级集合表
 * @author 何启谦
 * @date 2019-02-14
 */
@Service
public class CrowdAggritemServiceImpl extends BasicServiceImpl<CrowdAggritem> implements CrowdAggritemService {

    @Resource
    private CrowdAggritemMapper crowdAggritemMapper;

    @Override
    public BasicMapper<CrowdAggritem> getBasicMapper() {
        return crowdAggritemMapper;
    }

    @Override
    public List<CrowdAggritem> queryByHeadId(Long parAggrId) throws Exception {
        QueryParams qps = new QueryParams();
        qps.setPageFlag(false);
        qps.setTotalFlag(false);
        qps.addFilter(new Filter("parAggrId", String.valueOf(parAggrId)));
        qps.addSorter(new Sorter("seq", Sorter.DIR_ASC));
        CrowdAggritem crowdAggritem = (CrowdAggritem) BasicModel.transformClass(CrowdAggritem.class, qps);
        return queryByExamplePage(crowdAggritem);
    }
}

